package com.shinvent.common;

import com.shinvent.dao.BaseDao;
import com.shinvent.dao.V_ORDER_ID_NEXTDao;

public class GeneralFunctions {
	
	static public String getNextOrderID() throws Exception{
		V_ORDER_ID_NEXTDao nextDao = null;
		String nextID = "";
		try{
			nextDao = new V_ORDER_ID_NEXTDao();
			nextDao.query();
			if(nextDao.gotoNext()){
				nextID = nextDao.getString("NEXTID");
			}
			release(nextDao);
			return nextID;
		}catch(Exception e){
			e.printStackTrace();
			Logger.logError(e);
			throw new Exception();
		}finally{
			release(nextDao);
		}
	}
	
	static private void release(BaseDao dao){
		try{
			dao.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
